require("../../../@babel/runtime/helpers/Objectvalues"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "shop/components/sku/index" ], {
    "0176": function(t, e, n) {
        n.r(e);
        var i = n("e21c"), o = n.n(i);
        for (var s in i) "default" !== s && function(t) {
            n.d(e, t, function() {
                return i[t];
            });
        }(s);
        e.default = o.a;
    },
    "2c1b": function(t, e, n) {
        n.r(e);
        var i = n("a959"), o = n("0176");
        for (var s in o) "default" !== s && function(t) {
            n.d(e, t, function() {
                return o[t];
            });
        }(s);
        n("7ee6");
        var r = n("f0c5"), c = Object(r.a)(o.default, i.b, i.c, !1, null, "7ab68510", null, !1, i.a, void 0);
        e.default = c.exports;
    },
    "35b1": function(t, e, n) {},
    "7ee6": function(t, e, n) {
        var i = n("35b1");
        n.n(i).a;
    },
    a959: function(t, e, n) {
        n.d(e, "b", function() {
            return i;
        }), n.d(e, "c", function() {
            return o;
        }), n.d(e, "a", function() {});
        var i = function() {
            var t = this, e = (t.$createElement, t._self._c, 2 == t.info.spec ? t.selOptionsName.join(" + ") || "-" : null), n = t.__map(t.keys, function(e, n) {
                return {
                    $orig: t.__get_orig(e),
                    l0: t.__map(e, function(e, i) {
                        return {
                            $orig: t.__get_orig(e),
                            m0: t.canClick(e, i, n),
                            m1: t.active[n] != i ? t.canClick(e, i, n) : null,
                            m2: t.canClick(e, i, n)
                        };
                    })
                };
            });
            t.$mp.data = Object.assign({}, {
                $root: {
                    g0: e,
                    l1: n
                }
            });
        }, o = [];
    },
    e21c: function(t, e, n) {
        (function(t) {
            Object.defineProperty(e, "__esModule", {
                value: !0
            }), e.default = void 0;
            var i = n("26cb"), o = n("a71e"), s = n("8434"), r = n("556d"), c = n("7960"), u = n("db8f"), a = n("8f9b");
            function f(t, e) {
                var n = Object.keys(t);
                if (Object.getOwnPropertySymbols) {
                    var i = Object.getOwnPropertySymbols(t);
                    e && (i = i.filter(function(e) {
                        return Object.getOwnPropertyDescriptor(t, e).enumerable;
                    })), n.push.apply(n, i);
                }
                return n;
            }
            function l(t) {
                for (var e = 1; e < arguments.length; e++) {
                    var n = null != arguments[e] ? arguments[e] : {};
                    e % 2 ? f(Object(n), !0).forEach(function(e) {
                        p(t, e, n[e]);
                    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : f(Object(n)).forEach(function(e) {
                        Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
                    });
                }
                return t;
            }
            function p(t, e, n) {
                return e in t ? Object.defineProperty(t, e, {
                    value: n,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : t[e] = n, t;
            }
            !function(t) {
                t && t.__esModule;
            }(n("03b8"));
            Object.values = function(t) {
                return Object.keys(t).map(function(e) {
                    return t[e];
                });
            };
            var h = {
                components: {
                    stepper: function() {
                        n.e("shop/components/stepper/index").then(function() {
                            return resolve(n("50a8"));
                        }.bind(null, n)).catch(n.oe);
                    }
                },
                data: function() {
                    return {
                        initPrice: "",
                        initStock: "",
                        isShow: 0,
                        height: "",
                        sign_id: "",
                        goods_str: "",
                        priceSign: "",
                        active: "",
                        specClass: "none",
                        selectNum: 1,
                        shop_img: "",
                        colorText: "",
                        isVip: "",
                        memberTitles: ""
                    };
                },
                mounted: function() {
                    var t = {};
                    Object.keys(this.keys).forEach(function(e) {
                        return t[e] = null;
                    }), this.active = t, this.colorText = (0, u.colorRgba)(this.configs.btn2BgColor, .1), 
                    this.getVip(), this.memberTitles = (0, o.isEmpty)(this.configs.vip_set.good_buy_title) ? "仅会员可购买" : this.configs.vip_set.good_buy_title;
                },
                computed: l(l({}, (0, i.mapGetters)([ "configs", "mainColor", "user", "iphoneXStyle", "priceColor" ])), {}, {
                    selIds: function() {
                        var t = [];
                        for (var e in this.active) this.active[e] && t.push(this.keys[e][this.active[e]]);
                        return t;
                    },
                    selPath: function() {
                        return this.sign_id = this.getPath(this.selIds), this.getPath(this.selIds);
                    },
                    selOptionsName: function() {
                        var t = [];
                        for (var e in this.active) this.active[e] && t.push(this.active[e]);
                        return t;
                    },
                    price: function() {
                        var t = this.skus[this.selPath], e = t && t.prices;
                        if (e) {
                            var n = Math.max.apply(Math, e), i = Math.min.apply(Math, e);
                            return n > i ? i + "-" + n : n;
                        }
                        return " ";
                    },
                    stock: function() {
                        var t = this.skus[this.selPath];
                        return this.shop_img = t && t.img || "", t && t.stock || "-";
                    },
                    skus: function() {
                        for (var t = this, e = {}, n = function(t, n) {
                            e[t] ? (e[t].stock += n.stock, e[t].prices.push(n.price)) : e[t] = {
                                stock: n.stock,
                                prices: [ n.price ],
                                img: n.img
                            };
                        }, i = function(e, i) {
                            !function(e, o) {
                                for (var s = e.length, r = [], c = 0; c < s; c += o) r.push(e.slice(c, c + o));
                                for (var u = r, a = [], f = 0; f < u.length; f++) {
                                    var l = a.length;
                                    for (var p in u[f]) a.push([ u[f][p] ]);
                                    for (var h = 0; h < l; h++) for (var d in u[f]) a.push(a[h].concat(u[f][d]));
                                }
                                a.forEach(function(e, o) {
                                    var s;
                                    s = t.getPath(e), n(s, i);
                                });
                            }(e, 1);
                        }, o = 0, s = Object.keys(this.values); o < s.length; o++) {
                            var r = s[o], c = this.values[r], u = r.split(",").sort();
                            u.length, i(u, c), e[t.getPath(r.split(","))] = {
                                stock: c.stock,
                                prices: [ c.price ],
                                img: c.img
                            };
                        }
                        return e;
                    }
                }),
                props: {
                    keys: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    },
                    values: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    },
                    info: {
                        type: Object,
                        default: function() {
                            return {};
                        }
                    }
                },
                methods: {
                    getVip: function() {
                        var t = this;
                        (0, r.isVip)({}).then(function(e) {
                            t.isVip = e.vip;
                        });
                    },
                    memberBuy: function() {
                        this.isVip ? this.buy() : (0, s.route)({
                            url: "/member/member/memCenter",
                            type: 1,
                            data: {}
                        });
                    },
                    buy: function() {
                        var e = this;
                        (0, c.h5JudgeLogin)(2).then(function(n) {
                            if (!n) {
                                var i, r = "", c = [], u = "", f = "", l = {}, p = e, h = p.selPath.split(",");
                                if ("1" == p.info.spec && p.info.stock <= 0) return t.showToast({
                                    title: "该商品库存不足",
                                    duration: 2e3,
                                    icon: "none"
                                }), p.$toast("该商品库存不足", "none"), !1;
                                if ("2" == p.info.spec && p.stock <= 0) return t.showToast({
                                    title: "该商品库存不足",
                                    duration: 2e3,
                                    icon: "none"
                                }), !1;
                                if ("" == h[0] && "2" == p.info.spec) return t.showToast({
                                    title: "请先选择规格属性",
                                    duration: 2e3,
                                    icon: "none"
                                }), !1;
                                if (h.length !== e.getLength() && "" !== h[0]) return t.showToast({
                                    title: "请选全规格属性",
                                    duration: 2e3,
                                    icon: "none"
                                });
                                if ("1" === p.info.spec) u = -1, f = "", r = p.info.price; else {
                                    var d = "", g = "";
                                    r = p.price, p.selOptionsName.map(function(t, e) {
                                        d += 0 === e ? t : " " + t;
                                    });
                                    for (var m = p.sign_id.split(","), v = 0; v < m.length; v++) g += 0 === v ? m[v] : ":" + m[v];
                                    u = g.split(":").map(Number).sort(function(t, e) {
                                        return t - e;
                                    }).join(":"), f = d;
                                }
                                l.title = p.info.title, l.imglist = [ p.info.imglist[0] ], i = {
                                    unit_price: r,
                                    goods_info: l,
                                    num: e.selectNum,
                                    goods_str: f,
                                    total_price: parseFloat(r * e.selectNum),
                                    img: (0, o.isEmpty)(p.info.video) ? p.info.imglist[0] : p.info.imglist[1]
                                }, c.push({
                                    id: e.info.id,
                                    sign_id: u,
                                    num: e.selectNum,
                                    good_str: f,
                                    is_form: p.info.is_form,
                                    form_id: p.info.form_id,
                                    item: i
                                });
                                var b = {
                                    key: "cart",
                                    value: JSON.stringify(c)
                                };
                                (0, a.saveCache)(b).then(function(t) {
                                    (0, s.route)({
                                        url: "/shop/order/confirmOrder",
                                        type: 1,
                                        data: {
                                            type: 1,
                                            good_type: p.info.type
                                        }
                                    }), p.closeSf();
                                });
                            }
                        });
                    },
                    addCar: function() {
                        var e = this;
                        (0, c.h5JudgeLogin)(2).then(function(n) {
                            if (!n) {
                                var i = e, o = i.selPath.split(",");
                                if ("1" == i.info.spec && i.info.stock <= 0) return t.showToast({
                                    title: "该商品库存不足",
                                    duration: 2e3,
                                    icon: "none"
                                }), !1;
                                if ("2" == i.info.spec && i.stock <= 0) return t.showToast({
                                    title: "该商品库存不足",
                                    duration: 2e3,
                                    icon: "none"
                                }), !1;
                                if ("" == o[0] && "2" == i.info.spec) return t.showToast({
                                    title: "请先选择规格属性",
                                    duration: 2e3,
                                    icon: "none"
                                }), !1;
                                if (o.length !== e.getLength() && "" !== o[0]) return t.showToast({
                                    title: "请选全规格属性",
                                    duration: 2e3,
                                    icon: "none"
                                });
                                if (i.selectNum < 0 || 0 == i.selectNum) return t.showToast({
                                    title: "请选择商品数量",
                                    duration: 2e3,
                                    icon: "none"
                                }), !1;
                                var s = "", r = "";
                                i.selOptionsName.map(function(t, e) {
                                    s += 0 === e ? t : " " + t;
                                });
                                for (var c = i.sign_id.split(","), u = 0; u < c.length; u++) r += 0 === u ? c[u] : ":" + c[u];
                                var f = {};
                                "2" == i.info.spec ? (f.good_id = i.info.id, f.num = i.selectNum, f.sign_id = r, 
                                f.goods_str = s) : (f.good_id = i.info.id, f.num = i.selectNum), (0, a.goodCarAdd)(f).then(function(e) {
                                    2005 == e.code ? t.showToast({
                                        title: e.msg,
                                        duration: 3e3,
                                        icon: "none"
                                    }) : (t.showToast({
                                        title: "添加成功",
                                        duration: 3e3,
                                        icon: "none"
                                    }), i.closeSf());
                                }).catch(function(t) {
                                    return console.log(t);
                                });
                            }
                        });
                    },
                    getLength: function(t) {
                        var e = 0;
                        for (var n in this.keys) e++;
                        return e;
                    },
                    changeNum: function(t) {
                        this.selectNum = parseInt(t);
                    },
                    moveHandle: function() {},
                    getPath: function(t) {
                        return t.sort().join(",");
                    },
                    closeSf: function() {
                        var t = this;
                        this.specClass = "hide", setTimeout(function() {
                            t.specClass = "none";
                        }, 250);
                    },
                    showSpec: function(t) {
                        var e = this;
                        e.initStock = e.info.stock, this.shop_img = this.info.imglist[0].hasOwnProperty("type") ? this.info.imglist[1] : this.info.imglist[0], 
                        "2" === e.info.spec ? e.initPrice = e.info.min_price + "-" + e.info.max_price : "1" === e.info.spec && (e.initPrice = e.info.price), 
                        e.height = "1" === e.info.spec ? "60%" : "75%", e.specClass = "show", e.specCallback = t;
                    },
                    select: function(t, e, n, i) {
                        if (this.isShow = 1, i) return !1;
                        this.active[n] === e ? this.active[n] = null : this.active[n] = e;
                    },
                    canClick: function(t, e, n) {
                        if (-1 !== this.selIds.indexOf(t)) return !0;
                        var i = this, o = this.selIds.filter(function(e) {
                            return e !== t;
                        }).filter(function(t) {
                            return -1 === Object.values(i.keys[n]).indexOf(t);
                        }), s = this.skus[i.getPath(o.concat(t))];
                        return s && s.stock > 0;
                    }
                },
                watch: {
                    keys: function() {
                        var t = {};
                        Object.keys(this.keys).forEach(function(e) {
                            return t[e] = null;
                        }), this.active = t;
                    }
                }
            };
            e.default = h;
        }).call(this, n("543d").default);
    }
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "shop/components/sku/index-create-component", {
    "shop/components/sku/index-create-component": function(t, e, n) {
        n("543d").createComponent(n("2c1b"));
    }
}, [ [ "shop/components/sku/index-create-component" ] ] ]);